//
//  ShopCartTableViewCell.m
//  EasyToTesco
//
//  Created by mc on 16/2/17.
//  Copyright © 2016年 Jack. All rights reserved.
//

#import "ShopCartTableViewCell.h"
#import "HeaderFileForEasyToTesco.h"
<<<<<<< HEAD
#import "UIImageView+WebCache.h"
=======
>>>>>>> dd1aac4040986135177ad18eb7781566439f59ee


@interface ShopCartTableViewCell ()

{
    BOOL btnSenderJudge;
}



@end

@implementation ShopCartTableViewCell

//cell前面的选择按钮
- (IBAction)SelectBtnClick:(id)sender {
    [self.delegate btnClick:self button:sender];
}


#pragma mark - 工厂方法：创建cell，给tableView重用
<<<<<<< HEAD
+ (instancetype)cellWithTableView:(UITableView *)tableView 
=======
+ (instancetype)cellWithTableView:(UITableView *)tableView
>>>>>>> dd1aac4040986135177ad18eb7781566439f59ee
{
    static NSString *reuseIdentifier = @"ShopCartTableViewCell";
    ShopCartTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"ShopCartTableViewCell" owner:nil options:nil] lastObject];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.selectedBtn.layer.cornerRadius = CGRectGetHeight(cell.selectedBtn.frame)/2;
        cell.selectedBtn.layer.masksToBounds = YES;
    }
    
    
    return cell;
}

//给每一个cell赋值
//赋值
-(void)addTheValue:(SCProductInfo *)goodsModel {
<<<<<<< HEAD
//    self.ShopCartPic.image = [UIImage imageNamed:goodsModel.shopPicUrl];
    [self.ShopCartPic sd_setImageWithURL:[NSURL URLWithString:goodsModel.shopPicUrl]];
=======
    self.ShopCartPic.image = [UIImage imageNamed: goodsModel.shopPicUrl];
>>>>>>> dd1aac4040986135177ad18eb7781566439f59ee
 
    self.ShopCartTitle.text = goodsModel.shopCartName;
    self.ShopCartmodel.text = goodsModel.shopCartType;
    self.ShopCartColor.text = goodsModel.shopcartColor;
    self.ShopCartPrice.text = [NSString stringWithFormat:@"¥ %@", goodsModel.shopcartPrice];//goodsModel.shopcartPrice;
<<<<<<< HEAD

    if ([goodsModel.rate length] != 0) {
        self.rateLabel.text = [NSString stringWithFormat:@"费率:%@%%", goodsModel.rate];
    } else {
        self.rateLabel.text = @"";
    }
=======
>>>>>>> dd1aac4040986135177ad18eb7781566439f59ee
    self.ShopCartCount.text = [NSString stringWithFormat:@"×%@", goodsModel.shopcartCount];//goodsModel.shopcartCount;
    if (goodsModel.selectState){
        
        _selectState = YES;
<<<<<<< HEAD
        self.selectedBtn.selected = _selectState;
//        [self.selectedBtn setBackgroundImage:[UIImage imageNamed:@"flight_butn_check_select"] forState:UIControlStateNormal];
    }else{
        _selectState = NO;
        self.selectedBtn.selected = _selectState;
//         [self.selectedBtn setBackgroundImage:[UIImage imageNamed:@"flight_butn_check_unselect"] forState:UIControlStateNormal];
=======
        [self.selectedBtn setBackgroundImage:[UIImage imageNamed:@"flight_butn_check_select"] forState:UIControlStateNormal];
    }else{
        _selectState = NO;
         [self.selectedBtn setBackgroundImage:[UIImage imageNamed:@"flight_butn_check_unselect"] forState:UIControlStateNormal];
>>>>>>> dd1aac4040986135177ad18eb7781566439f59ee
    }
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
